// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

/// A dyn-compatible, crate-private version of [super::Firestore].
#[async_trait::async_trait]
pub trait Firestore: std::fmt::Debug + Send + Sync {
    async fn get_document(
        &self,
        req: crate::model::GetDocumentRequest,
        options: gax::options::RequestOptions,
    ) -> crate::Result<gax::response::Response<crate::model::Document>>;

    async fn list_documents(
        &self,
        req: crate::model::ListDocumentsRequest,
        options: gax::options::RequestOptions,
    ) -> crate::Result<gax::response::Response<crate::model::ListDocumentsResponse>>;

    async fn update_document(
        &self,
        req: crate::model::UpdateDocumentRequest,
        options: gax::options::RequestOptions,
    ) -> crate::Result<gax::response::Response<crate::model::Document>>;

    async fn delete_document(
        &self,
        req: crate::model::DeleteDocumentRequest,
        options: gax::options::RequestOptions,
    ) -> crate::Result<gax::response::Response<()>>;

    async fn begin_transaction(
        &self,
        req: crate::model::BeginTransactionRequest,
        options: gax::options::RequestOptions,
    ) -> crate::Result<gax::response::Response<crate::model::BeginTransactionResponse>>;

    async fn commit(
        &self,
        req: crate::model::CommitRequest,
        options: gax::options::RequestOptions,
    ) -> crate::Result<gax::response::Response<crate::model::CommitResponse>>;

    async fn rollback(
        &self,
        req: crate::model::RollbackRequest,
        options: gax::options::RequestOptions,
    ) -> crate::Result<gax::response::Response<()>>;

    async fn partition_query(
        &self,
        req: crate::model::PartitionQueryRequest,
        options: gax::options::RequestOptions,
    ) -> crate::Result<gax::response::Response<crate::model::PartitionQueryResponse>>;

    async fn list_collection_ids(
        &self,
        req: crate::model::ListCollectionIdsRequest,
        options: gax::options::RequestOptions,
    ) -> crate::Result<gax::response::Response<crate::model::ListCollectionIdsResponse>>;

    async fn batch_write(
        &self,
        req: crate::model::BatchWriteRequest,
        options: gax::options::RequestOptions,
    ) -> crate::Result<gax::response::Response<crate::model::BatchWriteResponse>>;

    async fn create_document(
        &self,
        req: crate::model::CreateDocumentRequest,
        options: gax::options::RequestOptions,
    ) -> crate::Result<gax::response::Response<crate::model::Document>>;
}

/// All implementations of [super::Firestore] also implement [Firestore].
#[async_trait::async_trait]
impl<T: super::Firestore> Firestore for T {
    /// Forwards the call to the implementation provided by `T`.
    async fn get_document(
        &self,
        req: crate::model::GetDocumentRequest,
        options: gax::options::RequestOptions,
    ) -> crate::Result<gax::response::Response<crate::model::Document>> {
        T::get_document(self, req, options).await
    }

    /// Forwards the call to the implementation provided by `T`.
    async fn list_documents(
        &self,
        req: crate::model::ListDocumentsRequest,
        options: gax::options::RequestOptions,
    ) -> crate::Result<gax::response::Response<crate::model::ListDocumentsResponse>> {
        T::list_documents(self, req, options).await
    }

    /// Forwards the call to the implementation provided by `T`.
    async fn update_document(
        &self,
        req: crate::model::UpdateDocumentRequest,
        options: gax::options::RequestOptions,
    ) -> crate::Result<gax::response::Response<crate::model::Document>> {
        T::update_document(self, req, options).await
    }

    /// Forwards the call to the implementation provided by `T`.
    async fn delete_document(
        &self,
        req: crate::model::DeleteDocumentRequest,
        options: gax::options::RequestOptions,
    ) -> crate::Result<gax::response::Response<()>> {
        T::delete_document(self, req, options).await
    }

    /// Forwards the call to the implementation provided by `T`.
    async fn begin_transaction(
        &self,
        req: crate::model::BeginTransactionRequest,
        options: gax::options::RequestOptions,
    ) -> crate::Result<gax::response::Response<crate::model::BeginTransactionResponse>> {
        T::begin_transaction(self, req, options).await
    }

    /// Forwards the call to the implementation provided by `T`.
    async fn commit(
        &self,
        req: crate::model::CommitRequest,
        options: gax::options::RequestOptions,
    ) -> crate::Result<gax::response::Response<crate::model::CommitResponse>> {
        T::commit(self, req, options).await
    }

    /// Forwards the call to the implementation provided by `T`.
    async fn rollback(
        &self,
        req: crate::model::RollbackRequest,
        options: gax::options::RequestOptions,
    ) -> crate::Result<gax::response::Response<()>> {
        T::rollback(self, req, options).await
    }

    /// Forwards the call to the implementation provided by `T`.
    async fn partition_query(
        &self,
        req: crate::model::PartitionQueryRequest,
        options: gax::options::RequestOptions,
    ) -> crate::Result<gax::response::Response<crate::model::PartitionQueryResponse>> {
        T::partition_query(self, req, options).await
    }

    /// Forwards the call to the implementation provided by `T`.
    async fn list_collection_ids(
        &self,
        req: crate::model::ListCollectionIdsRequest,
        options: gax::options::RequestOptions,
    ) -> crate::Result<gax::response::Response<crate::model::ListCollectionIdsResponse>> {
        T::list_collection_ids(self, req, options).await
    }

    /// Forwards the call to the implementation provided by `T`.
    async fn batch_write(
        &self,
        req: crate::model::BatchWriteRequest,
        options: gax::options::RequestOptions,
    ) -> crate::Result<gax::response::Response<crate::model::BatchWriteResponse>> {
        T::batch_write(self, req, options).await
    }

    /// Forwards the call to the implementation provided by `T`.
    async fn create_document(
        &self,
        req: crate::model::CreateDocumentRequest,
        options: gax::options::RequestOptions,
    ) -> crate::Result<gax::response::Response<crate::model::Document>> {
        T::create_document(self, req, options).await
    }
}
